package com.jianbing.http;

import org.apache.commons.httpclient.methods.multipart.PartSource;

import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;

/**
 * Created by Han, Tixiang on 2016/11/16 0016.
 */
public class InputParSource implements PartSource {
    private long length;
    private InputStream inputStream;

    public InputParSource(byte[] ips){
        this.length = ips.length;
        this.inputStream = new ByteArrayInputStream(ips);
    }
    @Override
    public long getLength() {
        return length;
    }

    @Override
    public String getFileName() {
        return "";
    }

    @Override
    public InputStream createInputStream() throws IOException {
        return inputStream;
    }
}
